#ifndef REGISTERWIN_H
#define REGISTERWIN_H

#include <QWidget>
#include <QThread>
#include "sqliteoperator.h"
#include "faceobject.h"

namespace Ui {
class RegisterWin;
}

typedef enum
{
    BY_FILE,
    BY_CAP
}GetPicType;

class RegisterWin : public QWidget
{
    Q_OBJECT

public:
    explicit RegisterWin(QWidget *parent = nullptr);
    ~RegisterWin();

signals:
    void ask_register(cv::Mat& img);

private slots:
    void on_resetBtn_clicked();

    void on_fileBtn_clicked();

    void on_regBtn_clicked();

    void on_CapBtn_clicked();

    void timerEvent(QTimerEvent *e);
    void on_snapBtn_clicked();

    void get_reg_faceid(const int face_id);
private:
    Ui::RegisterWin *ui;
    SqliteOperator *sql_op;//数据库操作
    QThread *m_thread;
    FaceObject *m_faceop;

    //用于摄像头的timerid
    int cap_timer_id;
    cv::VideoCapture cap;
    cv::Mat cv_img;

    QPixmap avatar;
    QString avatar_path;

    GetPicType m_pictype;

};

#endif // REGISTERWIN_H
